package TestDemo13;

import java.util.ArrayList;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别

        int num=in.nextInt();
        if(num == 1){
            System.out.println(1);
            return;
        }
        int max=0;
        int count=0;
        while(num > 0){
            if((num&1) == 1){
                count++;
            } else if((num&1) == 0){
                if(count > max){
                    max=count;

                }
                count=0;
            }

            num>>>=1;

        }
        if(count > max){
            max=count;
            count=0;
        }
        System.out.println(max);
    }
}
